From 6e2bde98964b4d1fb87da24049388e9bf87f7222 Mon Sep 17 00:00:00 2001 From: robertl Date: Wed, 6 Feb 2008 02:29:22 +0000 Subject: [PATCH] Add option to 'discard' filter to require minimum number of satellites. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@3080 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/discard.c | 14 ++++++++++++++ gpsbabel/xmldoc/filters/discard.xml | 24 +++++++++++++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/gpsbabel/discard.c b/gpsbabel/discard.c index d8f1942c5..0a8d29e4d 100644 --- a/gpsbabel/discard.c +++ b/gpsbabel/discard.c @@ -26,8 +26,10 @@ static char *hdopopt = NULL; static char *vdopopt = NULL; static char *andopt = NULL; +static char *satopt = NULL; static double hdopf; static double vdopf; +static int satpf; static gpsdata_type what; static route_head *head; @@ -39,6 +41,8 @@ arglist_t fix_args[] = { "-1.0", ARGTYPE_END_REQ | ARGTYPE_FLOAT, ARG_NOMINMAX}, {"hdopandvdop", &andopt, "Link hdop and vdop supression with AND", NULL, ARGTYPE_BOOL, ARG_NOMINMAX}, + {"sat", &satopt, "Minimium sats to keep waypoints", + "-1.0", ARGTYPE_BEGIN_REQ | ARGTYPE_INT, ARG_NOMINMAX}, ARG_TERMINATOR }; @@ -51,6 +55,7 @@ fix_process_wpt(const waypoint *wpt) int del = 0; int delh = 0; int delv = 0; + waypoint *waypointp = (waypoint *) wpt; if ((hdopf >= 0.0) && (waypointp->hdop > hdopf)) @@ -62,6 +67,9 @@ fix_process_wpt(const waypoint *wpt) del = delh && delv; else del = delh || delv; + + if ((satpf >= 0) && (waypointp->sat < satpf)) + del = 1; if (del) { switch(what) { @@ -116,6 +124,12 @@ fix_init(const char *args) vdopf = atof(vdopopt); else vdopf = -1.0; + + if (satopt) + satpf = atoi(satopt); + else + satpf = -1; + } filter_vecs_t discard_vecs = { diff --git a/gpsbabel/xmldoc/filters/discard.xml b/gpsbabel/xmldoc/filters/discard.xml index 82bd9bf90..9b2a2ad26 100644 --- a/gpsbabel/xmldoc/filters/discard.xml +++ b/gpsbabel/xmldoc/filters/discard.xml @@ -1,12 +1,26 @@ This filter is used to "fix" unreliable GPS data by discarding points -with HDOP and/or VDOP above a specified limit. HDOP and VDOP are -measures of the best possible horizontal or vertical precision -for a given configuration of GPS satellites. +that are believed to be unreliable. You may specify an +HDOP and/or VDOP above a specified limit, a minimum number of satellits +that must have been in view for a fix to be considered, or both. + +HDOP and VDOP are measures of the best possible horizontal or vertical precision for a given configuration of GPS satellites. Higher numbers indicate a higher dilution of precision and therefore mathematically less useful. + + -Using the discard filter +Using the discard filter for HDOP and VDOP. gpsbabel -i gpx -f in.gpx -x discard,hdop=10,vdop=20,hdopandvdop -o gpx -F out.gpx - Contributed by Tobias Minich. + + +You may specify a minimmum number of satellites. + + + +Using the discard filter to require at least three satellites. + gpsbabel -i gpx -f in.gpx -x discard,sat=3 -o gpx -F out.gpx + + + Contributed by Tobias Minich and Serge Droz. -- 2.30.2